import java.util.Scanner;

public class Add {
    public static int add(int n){
        int sum=0;
        if(n<=9){
            //System.out.println(n%10);
            return n;
        }
        return n%10 + add(n/10);
    }
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请输入一个值: ");
        int n = sc.nextInt();
            int ret=add(n);
        System.out.println(ret);
    }
}
